#ifndef SAFEVECTOR_H_
#define SAFEVECTOR_H_

#include <vector>

#include "Common\stragy\threadsafe\CriticalLock.h"

namespace FURY
{
	namespace CONTAINER
	{
		using FURY::STRAGY::CriticalLock;

		template<typename T>
		class SafeVector
		{
			std::vector<T>	m_container;
			CriticalLock	m_lock;
		public:
			SafeVector(void) {};
			~SafeVector(void) {};

		public:
			void Insert(const T& obj)
			{
				m_container.push_back(obj);
			};

			void Erase(int i)
			{
				m_container.erase(m_container.begin() + i);
			};

			T& operator[](int i)
			{
				return m_container[i];
			};

			T Get(int i)
			{
				T obj = m_container[i];
				return obj;
			};

			int Size() const
			{
				return m_container.size();
			};

			void Clear()
			{
				m_container.clear();
			};

			bool Empty() const
			{
				return m_container.empty();
			};

			operator CriticalLock&()
			{
				return m_lock;
			};
		};
	};
};

#endif	// SAFEVECTOR_H_